.generate-colgroups(@n, @i: 1) when (@i =< @n) {
  .colgroup-@{i} {
    .col{
      width: (1 * 100% / @n);

      &:nth-of-type(@{i}n+1) {
        clear: left;
      }
    }
  }
  .generate-colgroups(@n, (@i + 1));
}

.generate-colgroups(8);